<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>配餐配货管理-配货管理</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link href="/apply_assets/css/bootstrap.min.css" rel="stylesheet">
	<link href="/apply_assets/css/style.css" rel="stylesheet">
	<link href="/apply_assets/css/font-awesome.css" rel="stylesheet">
</head>

<body>
	<div class="container-fluid">
		<div class="om-ctl-mes">
			<div class="title">
				<div class="col-xs-12"><span class="fa fa-list-ul"> 配餐配货管理</span><b class="fa fa-caret-right"></b><i>配货管理</i></div>
			</div>
			<div class="seltemple peihuo-seltemple">
				<div class="col-xs-12">
					<form class="form-inline">
					<div class="col-xs-3 mes-group"><label>部门</label><select name="department" id="department"><option value="">请选择</option><?foreach($departmentinfo as $v ){?> <option value="<?=$v['num']?>" <?= $department_id==$v['num']?'selected':'';?> ><?=$v['introduce']?></option><?}?></select></div>
                    <div class="col-xs-3 mes-group"><label>配送状态</label><select name="statusid" id="status"><option value="0">全部</option><option value="1" <?= $statusid==1? 'selected':''; ?> >已提交</option>
<option value="3"<?= $statusid==3? 'selected':''; ?> >配送中</option>
<option value="5"<?= $statusid==5? 'selected':''; ?> >已收货</option></select></div>
					<div class="col-xs-3 mes-btn off-btn"><button style="width:90px" type="button" onclick="location.href='/admin_apply';">新增</button></div>
				</form>
				</div>
			</div>
			<div  class="mes-conttent col-xs-12">
				<table class="table off-table">
	              <thead>
	             	<tr>
			        <th>编号</th>
			        <th>部门名称</th>
			        <th>申请物品</th>
			        <th>申请数量</th>
			        <th>申请时间</th>
			        <th>备注</th>
			        <th>操作人员</th>
			        <th>是否配送</th>
		            </tr>
	              </thead>
	             <tbody>
                    <?foreach($listinfo as $tRow){?>
                    <tr>
                        <td><?=$tRow['apply_id']?></td>
                        <td><?=$tRow['introduce']?></td>
                        <td><?=$tRow['apply_name']?></td>
                        <td><?=$tRow['apply_num']?><?=$tRow['apply_com']?></td>
                        <td><?=$tRow['apply_time']?></td>
                        <td><?=$tRow['apply_bei']?></td>
                        <td><?=$tRow['name']?></td>
                        <td><?if($tRow['sta_id']==1){echo '已提交';}elseif($tRow['sta_id']==3){echo "配送中";}elseif($tRow['sta_id']=='4'){?><button id="cg" onclick="purchase(<?=$tRow['apply_id']?>)">确认收货</button><?}elseif($tRow['sta_id']=='5'){echo $tRow['sta_name'];}else{echo '已收货';}?></td>

                    </tr>
                    <?}?>
	            </tbody>
              </table>
            <?=$pageinfo?>
			</div>
		</div>
    </div>
        <script type="text/javascript" src="/apply_assets/js/jquery.min.js"></script>
        <script type="text/javascript" src="/apply_assets/js/queren-alert.js"></script>
<script>
function purchase(appid){
           $.ajax({
            type:'post',
            url:'/admin_apply/updatestatus',
            data:{id:appid},
            success:function(msg){
                    if(msg.status==1){
                            alert('已修改')
                            window.location.reload();
                    }else{
                        alert(msg.msg)
                    }
            }
        })
}
   function recommit(){
           $.ajax({
            type:'post',
            url:'/admin_apply/conreceipt',
            data:$('form').serialize(),
            success:function(msg){
                    if(msg.status==1){
                            alert('已修改')
                            window.location.reload();
                    }else{
                        alert(msg.msg)
                    }
            }
        }) 
   }
   function searchinfo(){
              var statusid = $('#status').val();
              var department = $('#department').val();
             location.href="/admin_apply/list?statusid="+statusid+"&department_id="+department
    }
   $('select[name="statusid"]').change(function(){
        searchinfo();
   });
      function searchinfo1(){
              var statusid = $('#status').val();
              var department = $('#department').val();
             location.href="/admin_apply/list?statusid="+statusid+"&department_id="+department
    }
   $('select[name="department"]').change(function(){
        searchinfo1();
   });
</script>
</body>
</html>
